//
// Created by kaifamiao on 2022/3/20.
//

#include <iostream>
#include <vector>
#include<io.h>
#include <string.h>
#include "public.h"
#include <ctime>
#include <fstream>

using namespace std;
int ReadFile(){
    string filepathstr ="..//SH#600000.txt";
    const char* filepath = filepathstr.c_str();
//    cout << filepath <<endl;
//    FILE* file = fopen(filepath, "rb");
//    int size=0;
//    if (file)
//    {
//        size = filelength(fileno(file));
//        cout<< "file size ="<<size<< endl;
//        fclose(file);
//    }
//
//    char* data=new char[100];
    char data[100];
    ifstream infile;
    infile.open(filepath);
    if(!infile.is_open()){
        printl(RED,"open file error!!","\n");
        return 0;
    }
//    printl(GREEN,"start reading from the file","\n");
    int i=0;
    vector<string> v;
    i=1;
    while(!infile.eof()){
        if(strlen(data)!=0)
            v.push_back(data);
        infile.getline(data, sizeof(data));

        i++;
    }
//    printv(v);
    cout << v.size() <<endl;
    cout << v[0] <<endl;
    cout << v[v.size()-1] <<endl;
    cout << v[2070] <<endl;
    infile.close();

}
int show(int x,int y){
    ReadFile();
    return x+y;
}
int main(){
    exec(show,0,0);
    return 0;
}
